package edu.pku.sei.act.main.startup;

import org.eclipse.ui.IStartup;

import edu.pku.sei.act.ctrl.command.ArchiModelerCommandFactory;
import edu.pku.sei.act.main.project.ArchiModelerProject;
import edu.pku.sei.act.main.project.ArchiModelerProjectFactory;
import edu.pku.sei.act.main.provider.ArchiModelerEditorDropTargetListenerProxyon;
import edu.pku.sei.act.main.provider.ArchiModelerViewerDropAdapterProxyon;
import edu.pku.sei.act.main.provider.ArchiModelerContentProvider;
import edu.pku.sei.act.main.provider.ArchiModelerEditorActionProvider;
import edu.pku.sei.act.main.provider.ArchiModelerExplorerActionProvider;
import edu.pku.sei.act.main.provider.ArchiModelerLabelProvider;
import edu.pku.sei.gmp.controller.command.GMPCommandFactoryRegistry;
import edu.pku.sei.gmp.editor.registry.GMPEditorActionProviderRegistry;
import edu.pku.sei.gmp.editor.registry.GMPEditorDropTargetListenerProxyonRegistry;
import edu.pku.sei.gmp.explorer.registry.GMPExplorerActionProviderRegistry;
import edu.pku.sei.gmp.explorer.registry.GMPExplorerDropAdapterProxyonRegistry;
import edu.pku.sei.gmp.explorer.registry.GMPExplorerProviderRegistry;
import edu.pku.sei.gmp.project.registry.GMPProjectRegistry;

public class ArchiModelStartup implements IStartup {

	@Override
	public void earlyStartup() {

		Register();
		
	}

	private void Register() {

		// register project factory
		ArchiModelerProjectFactory factory = new ArchiModelerProjectFactory();
	    GMPProjectRegistry.getInstance().registerFactory(factory);
		
	    // register contentProvider,labelProvider for ModelExplorer
	    GMPExplorerProviderRegistry.getInstance().registerProvider(
				ArchiModelerProject.PROJECT_NATURE, new ArchiModelerContentProvider(),
				new ArchiModelerLabelProvider());
	    
	   // register actionProvider for ModelExplorer
		GMPExplorerActionProviderRegistry.getInstance().registerActionProvider(
				new ArchiModelerExplorerActionProvider());
		
		// register dropAdapterProxyon for ModelExplorer
		GMPExplorerDropAdapterProxyonRegistry.getInstance().registerProxyon(
				ArchiModelerProject.PROJECT_NATURE,
				new ArchiModelerViewerDropAdapterProxyon());
		
		// register actionProvider for ModelerEditor
		GMPEditorActionProviderRegistry.getInstance().registerActionProvider(
				new ArchiModelerEditorActionProvider());
		
		// register dropTargetListenerProxyon for ModelerEditor
		GMPEditorDropTargetListenerProxyonRegistry.getInstance()
				.registerProxyon(ArchiModelerProject.PROJECT_NATURE,
						new ArchiModelerEditorDropTargetListenerProxyon());

		GMPCommandFactoryRegistry.getInstance().registerCommandFactory(
				ArchiModelerProject.PROJECT_NATURE,
				ArchiModelerCommandFactory.getInstance());
		
	}

}
